import request from '@/utils/request'

// 获取所有角色 params: {page, pagesize}
export const getRoles = (params) => request.get('/sys/role', { params })

// 根据id获取角色详情
export const getRolesDetail = (id) => request.get(`/sys/role/${id}`)

// 根据id修改角色 data: {companyId, description, id, name, permIds}
export const editRoles = (data) => request.put(`/sys/role/${data.id}`, data)

// 添加角色   data: {name, region}
export const addRoles = (data) => request.post(`/sys/role`, data)

// 根据id删除角色
export const delRoles = (id) => request.delete(`/sys/role/${id}`)

// 给角色分配权限  data: {id, permIds}
export const assignPrem = (data) => request.put('/sys/role/assignPrem', data)
